#include "entities/entity.h"

#include "entities/unit.h"

Entity::Entity():Pickable(){
    selected = false;
    buildPic = -1;
    turns_to_complete = 2;
    construction_paused = false;
    valid_position = true;
}

void Entity::EndTurn(){}

void Entity::AddToUnits(std::set<int> unitIDsToAdd){
    for(int id : unitIDsToAdd){
        AddToUnits(id);
    }
}

void Entity::AddToUnits(int unit){
    unitIDs.insert(unit);
    gamestate->GetUnit(unit)->SetIndex(index);
}

bool Entity::HasCombatUnits(){
    for(int id: unitIDs){
        if(gamestate->GetUnit(id)->IsCombatUnit()){
            return true;
        }
    }
    return false;
}

void Entity::RemoveFromUnits(int unit){
    unitIDs.erase(unit);
}

void Entity::RemoveFromUnits(std::set<int> unitIDsToRemove){
    unitIDs.erase(unitIDsToRemove.begin(), unitIDsToRemove.end());
}
